<?php
/**
 * Created by PhpStorm.
 * User: zhangrxiang
 * Date: 2016/12/21
 * Time: 11:13
 */
//Closure {
//	/* 方法 */
//	__construct ( void )
//  public static Closure bind ( Closure $closure , object $newthis [, mixed $newscope = 'static' ] )
//  public Closure bindTo ( object $newthis [, mixed $newscope = 'static' ] )
//}

function createGreeter($who) {
	return function() use ($who) {
		echo "Hello $who";
	};
}
function testClosure(){
	return function (){
		echo "---Hello World--";
		$a = "a";
		return function() use ($a){
			echo "+++Hello World+++";
		};
	};
}
$test = testClosure();
$t = $test();
$t();
$greeter = createGreeter("World");
$greeter(); // Hello World
